import requests
url = 'http://www.baidu.com/s'
headers= {
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0'
}
data = {
    'wd':'ip'
}
# # 提取代理API接口，获取1个代理IP
# api_url = "https://kps.kdlapi.com/api/getkps/?secret_id=o2cthikr9d3oulyerwsg&signature=ag24g9i1qweb9lhzja8kqimtynnjdkny&num=1&pt=1&sep=1"
#
# # 获取API接口返回的代理IP
# proxy_ip = requests.get(api_url).text
#
# # 用户名密码认证(私密代理/独享代理)
# username = "hkezjpjy"
# password = "f0u1q9a9"
# proxies = {
#     "http": "http://%(user)s:%(pwd)s@%(proxy)s/" % {"user": username, "pwd": password, "proxy": proxy_ip},
#     "https": "http://%(user)s:%(pwd)s@%(proxy)s/" % {"user": username, "pwd": password, "proxy": proxy_ip}
# }
proxies = {
    'http':'59.36.175.179:16817'
}
print(proxies)
response = requests.get(url=url,headers=headers,params=data,proxies=proxies)
response.encoding='utf-8'
content = response.text
with open('daili.html','w',encoding='utf-8') as fp:
    fp.write(content)